@extends('admin.layout.base')
@section('title', '网站配置管理')
@section('content')
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            修改网站配置
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ url('/admin') }}"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">网站配置管理</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <!-- right column -->
            <div class="col-md-12">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">修改网站配置</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="btn-group">
                            <a href="{{ url('/admin/system/all') }}" class="btn btn-default">全部配置项</a>
                        </div>
                        <div class="nav-tabs-custom">
                            <ul class="nav nav-tabs">
                                <li class="active"><a href="#tab_0" data-toggle="tab" aria-expanded="false">基本配置</a></li>
                                <li class=""><a href="#tab_1" data-toggle="tab" aria-expanded="false">SEO配置</a></li>
                                <li class=""><a href="#tab_2" data-toggle="tab" aria-expanded="true">其他配置</a></li>
                                <li class="pull-right"><a href="{{ url('/admin/system/create') }}"><i class="fa fa-plus"></i></a></li>
                            </ul>
                            <br />
                            <form class="form-horizontal" action="{{ url('/admin/system/save') }}" method="post">
                                {!! csrf_field() !!}
                                <div class="tab-content">
                                    @foreach($sysconfigs as $key => $configs)
                                    <div class="tab-pane{{ $key==0?' active':''}}" id="tab_{{ $key }}">
                                        @foreach($configs as $config )
                                        <div class="form-group">
                                            <label for="{{ $config->key }}" class="col-sm-2 control-label">{{ $config->title }}</label>
                                            <div class="col-sm-6{{ $config->type == 'radio' ? ' radio' : '' }}">
                                                @if($config->type == 'string')
                                                <input type="text" class="form-control" id="{{ $config->key }}" name="{{ $config->key }}" value="{{ $config->value }}">
                                                @elseif($config->type == 'textarea')
                                                <textarea name="{{ $config->key }}" id="{{ $config->key }}" class="form-control" rows="3">{{ $config->value }}</textarea>
                                                @elseif($config->type == 'radio')
                                                    @foreach($config->kv as $k => $v)
                                                    <label><input type="radio" name="{{ $config->key }}" {{ $k == $config->value ? 'checked' : '' }} value="{{ $k }}"/>{{ $v }}</label>
                                                    @endforeach
                                                @endif
                                            </div>
                                            <div class="col-sm-4">
                                                @if($errors->first($config->key))
                                                <p class="form-control-static text-danger">{{ $errors->first($config->key) }}</p>
                                                @else
                                                <p class="form-control-static small">{{ $config->tip }}</p>
                                                @endif
                                            </div>
                                        </div>
                                        @endforeach
                                    </div>
                                    @endforeach
                                </div>
                                <!-- /.tab-content -->
                                <hr />
                                <div class="col-sm-12">
                                    <div class="col-sm-offset-2">
                                        <button class="btn btn-primary" type="submit">保存</button>
                                        <button class="btn btn-default" type="reset">取消</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <!-- /.box -->
            </div>
            <!--/.col (right) -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
@endsection
@section('pluginscript')
<!-- FastClick -->
<script src="{{ asset('/dist/admin/plugins/fastclick/fastclick.js') }}"></script>
@endsection